package com.sec.foodit;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MenuView extends LinearLayout{

	private Context mContext;
	
	public MenuView(Context context) {
		super(context);
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.view_menu, null);
	}

	public MenuView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.view_menu, null);
	}

	public MenuView(Context context, AttributeSet attrs) {
		super(context, attrs);
		mContext = context;
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.view_menu, this);
	}
	
	@Override
	protected void onFinishInflate() {
		super.onFinishInflate();
		
		
		this.findViewById(R.id.menu1).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				//Go to HomeScreen
				mContext.startActivity(new Intent("com.sec.foodit.HomeScreenActivity").setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
				((Activity)mContext).overridePendingTransition(0, 0);
			}
		});
		
		this.findViewById(R.id.menu2).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				//Go to MyBoard
				mContext.startActivity(new Intent("com.sec.foodit.HomeScreenActivity").setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
				((Activity)mContext).overridePendingTransition(0, 0);
			}
		});
		
		this.findViewById(R.id.menu3).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				//Go to Favorite
				mContext.startActivity(new Intent("com.sec.foodit.FavoriteActivity").setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
				((Activity)mContext).overridePendingTransition(0, 0);
			}
		});
		
		this.findViewById(R.id.menu4).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				//Go to Setting
				mContext.startActivity(new Intent("com.sec.foodit.HomeScreenActivity").setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
				((Activity)mContext).overridePendingTransition(0, 0);
			}
		});
	}
	
	

}
